PCA Index Dashboard Examples

PCA Index Dashboard Examples#

This script was last run at 2024-02-29 21:30:40.630862+00:00 (UTC)
In US/Central Time, this is 2024-02-29 15:30:40.630862-06:00

Adding a new randomly generated timeseries and plotting it#

# Set seed for reproducibility
np.random.seed(0)

# Create a normally distributed 500 row timeseries with values from 0 to 1
ts = pd.Series(np.random.randn(500), index=pd.date_range('1/1/2000', periods=500))

# Add another column with a uniformly distributed 500 row timeseries with values from 0 to 1
ts = pd.concat([ts, pd.Series(np.random.rand(500), index=pd.date_range('1/1/2000', periods=500))], axis=1)

# Add another column with a chi-squared distributed 500 row timeseries with values from 0 to 1
ts = pd.concat([ts, pd.Series(np.random.chisquare(2, 500), index=pd.date_range('1/1/2000', periods=500))], axis=1)

# Add another column with a student-t distributed 500 row timeseries with values from 0 to 1
ts = pd.concat([ts, pd.Series(np.random.standard_t(2, 500), index=pd.date_range('1/1/2000', periods=500))], axis=1)

# Rename the columns to 'Normal' and 'Uniform'
ts.columns = ['Normal', 'Uniform', 'Chi-squared', 'Student-t']
# Plot scatter plot of the two timeseries with histograms in the sides
pd.plotting.scatter_matrix(ts, alpha=0.2, figsize=(6, 6), diagonal='hist')
plt.suptitle('Scatter Matrix of Timeseries')
plt.show()
../_images/e06eb26450a7d81407e2361816edf21b89c9b00e922ec9bbd41985e55a769269.png
../_images/8557787a3d53741648494a9fddedc78215b74fc174f4e95fdc5d1722b4ddc6ef.png
../_images/ad6f4da0a4bc2dc64d3060d1ff2b90587d9c92bceebd7ead96628558d64cad0d.png